package demo1;

/*
* 1.构造器私有化
* 2.本类内部创建一组对象 四个 春夏秋冬
* 3.对外暴露对象 -> 通过为对象前加 public final static 修饰符
* 4.可以提供 get 方法 但是只读不写(没有set方法)
* */


//自定义枚举类
public class TestEnum {
    private String name;
    private String character;//特点

    //对外暴露
    public static final TestEnum SPRING = new TestEnum("春天","花香");
    public static final TestEnum SUMMER = new TestEnum("夏天","烈日");
    public static final TestEnum AUTUMN = new TestEnum("秋天","气爽");
    public static final TestEnum WINNER = new TestEnum("冬天","大雪");

    //构造器私有化 -> 这样外界就不能直接创建对象 -> 防止直接 new
    private TestEnum() {

    }
    private TestEnum(String name, String character) {
        this.name = name;
        this.character = character;
    }

    //只提供 get 方法 只读不写
    public String getName() {
        return name;
    }

    public String getCharacter() {
        return character;
    }

    @Override
    public String toString() {
        return "TestEnum{" +
                "name='" + name + '\'' +
                ", character='" + character + '\'' +
                '}';
    }
}
